<?php  $pharmacy_id = $_SESSION['acc_id'];       
       $owner_id = $pharmacy_id;
       //echo $owner_id;
       
?>
<link rel="stylesheet" href="css/jquery.ui.all.css">
<script src="js/jquery-1.8.0.js"></script>
<script src="js/jquery.ui.core.js"></script>
<script src="js/jquery.ui.widget.js"></script>
<script src="js/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="css/demos.css">
<script>
    $(function() {
        $( "#datepicker" ).datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'yy-mm-dd' 
        });
		
        $( ".datepicker" ).datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'yy-mm-dd' 
        });
    });
</script>
<!-- /TinyMCE -->
<?php
if (!defined('W_ROOT')) {
    exit();
}
?>
<div class="row-fluid">
    <div class="box">
        <form action="process.php?action=add_promo"  method="post" name="frmlist" onSubmit="return validatePromotion()" enctype="multipart/form-data">
            <div class="title"><?php echo $lang['NEW_PROMOTION']; ?></div>
            <div class="row-fluid">	
                <div class="span4 offset8">
                    <input class="btn" type="submit" name="btnsave" value="<?php echo $lang['SAVE']; ?>"/>&nbsp;&nbsp;&nbsp;
                    <input class="btn" type="reset" name="btnreset" value="<?php echo $lang['RESET']; ?>" />&nbsp;&nbsp;&nbsp;
                    <input class="btn" type="button" name="btncancel" value="<?php echo $lang['CANCEL']; ?>" onClick="javascript:window.history.back();" />
                </div>
            </div>
            <h3><?php echo $lang['PROMO_INFO']; ?></h3>

            <table cellpadding="5" cellspacing="5" border="0" width="100%" align="center">
                <tr>
                    <td colspan="3" align="left"><strong style="color:#F00;">* <?php echo $lang['ARE_REQUIR']; ?></strong></td>
                </tr>
                 <tr>
                    <td colspan="3" align="left"><strong style="color: #000099;">Note: <?php echo $lang['PRODUCT_DOESNOT_EXIST']; ?></strong></td>
                </tr>

                <tr> 
                    <td width="10%" height="30" align="left" valign="top"><?php echo $lang['PRO_NAME']; ?></td>
                    <td width="5%" align="left" valign="top">:</td>
                    <td width="80%" align="left">

                        <?php
                        $p_get = mysql_query("SELECT p.* FROM tblproduct AS p, tblpharmacy AS phar WHERE phar.user_id = p.owner AND p.owner = $owner_id");
                        ?>
                        <select name="selectProduct" id="selectbox">
<!--                            <option>Select Promotion<?php //echo $lang['SEL_PRO']; ?></option>-->
                            <?php
                            while ($product = mysql_fetch_assoc($p_get)) {
                                ?>
                            <option value="<?php echo $product['id']; ?>"><?php echo $product['product_name']; ?></option>
                                <?php
                            }
                            ?>                           
                        </select>                       
                    </td>
                </tr>

                <tr> 
                    <td width="10%" height="30" align="left" valign="top"><?php echo $lang['QUANTITY']; ?></td>
                    <td width="5%" align="left" valign="top">:</td>
                    <td width="80%" align="left">
                        <input name="txtQuantity" type="text" placeholder="<?php echo $lang['QUANTITY']; ?>" alt="required" id="quantit"  value=""  />&nbsp;&nbsp;<strong style="color:#F00;">*</strong>
                    </td>
                </tr>

                <tr> 
                    <td width="10%" height="30" align="left" valign="top"><?php echo $lang['%PROMOTION']; ?></td>
                    <td width="5%" align="left" valign="top">:</td>
                    <td width="80%" align="left">
                        <input name="txtPromotion" type="text" placeholder="<?php echo $lang['%PROMOTION']; ?>" alt="required" id="promot"  value=""  />&nbsp;&nbsp;<strong style="color:#F00;">*</strong>
                    </td>
                </tr>

                <tr> 
                    <td width="10%" height="30" align="left" valign="top"><?php echo $lang['DATE_STOCK']; ?></td>
                    <td width="5%" align="left" valign="top">:</td>
                    <td width="80%" align="left">
                        <input name="txtDateStock" type="text" placeholder="<?php echo $lang['DATE_STOCK']; ?>"  id="datepicker" value="<?php //echo $last_name;  ?>"  />&nbsp;&nbsp;<strong style="color:#F00;">*</strong>
                    </td>
                </tr>

                <tr>
                    <td style="background-color: white">&nbsp;&nbsp</td>
                </tr>

            </table>

        </form>
    </div><!--<div class="box">-->
</div><!--<div class="row-fluid">-->
<script type="text/javascript" language="javascript">
    function validatePromotion(){
        var quantity=document.forms["frmlist"]["txtQuantity"].value;
        var promotion=document.forms["frmlist"]["txtPromotion"].value;
        var dateStock=document.forms["frmlist"]["txtDateStock"].value;       
        
        if (quantity==null || quantity=="") {
            alert(" Quantity must be filled out");
            return false;
        }
        if (promotion==null || promotion=="") {
            alert(" %promotion must be filled out");
            return false;
        }
        if (dateStock==null || dateStock=="") {
            alert(" Date_in_Stock must be filled out");
            return false;
        }
						  
        					  
    }
</script>